<?php
include_once($_SERVER["DOCUMENT_ROOT"].'/home/public/header.php');
if(!isset($_SESSION['user'])){
      echo '<script>alert("请登录后再留言!!!");window.location.href="/home/denglu/login.php"</script>';
   }
   $a=$_SESSION['user'];
   include_once($_SERVER["DOCUMENT_ROOT"].'/public/func.php');
   $config=include_once($_SERVER["DOCUMENT_ROOT"].'/public/config.php');
   $suiji=sel($config,'`guanli`','order by "rand" limit 0,5');
   $re=sel($config,'`lanmu`');
   $r=sel($config,'`pinglun`','order by addtime desc limit 0,5');

   $p =isset($_GET['p'])?$_GET['p']:'1';
   $num = 5;
   $offset = ($p-1)*$num;
   $rew=sel($config,'liuyan', "limit $offset,$num");


?>
<article class="blogs">
<h1 class="t_nav">
<span>我们长路漫漫，只因学无止境。</span>
<a href="/" class="n1">网站首恶</a>
<a href="/" class="n2">留言</a></h1>
<div class="newblog left">
  <?php  
foreach ($rew as $v) {
 echo '
    <p class="dateview"> <span> 发布时间：'.$v['addtime'].'</span>
    <span>留言过客：'.$v['author'].'</span>
    </p>
     <ul class="nlist">
       <p>'.$v['content'].'</p>  
     </ul>
     <div class="line"></div>
    ';
} 

 echo page($config,'liuyan');
?> 
  <div class="blank"></div>
  <div class="result-wrap">
            <div class="result-content">
                <form action="/home/liuyan/zeng.php" method="post" id="myform" name="myform" enctype="multipart/form-data">
                    <table class="insert-tab" width="80%">
                        <tbody>
                             <tr>
                                <td>
                                    <input class="common-text required" id="title" name="author" size="50" style="margin:20px auto;" value="<?php echo $a;?>" type="hidden">
                                </td>
                            </tr>
                            <tr>
                                <th>留言：</th>
                                <td><textarea name="content" class="common-textarea" id="content" cols="30" style="width: 98%;" rows="10"></textarea></td>
                            </tr>
                            <tr>
                                <th></th>
                                <td>
                                    <input class="btn btn-primary btn6 mr10" value="提交" type="submit">
                                    <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                                </td>
                            </tr>
                        </tbody>
                        </table>
                </form>
            </div>
        </div>   
</div>
<aside class="right">
   <div class="rnav">
   <div class="news">
      <h3>
    <p>随机<span>推荐</span></p>
    </h3>
      <ul>
      <?php
       foreach ($suiji as $v) {
 echo '<li><a href="/home/now.php?id='.$v['id'].'" target="_blank">'.$v['title'].'</a></li>';
}
      ?>
     </ul>      
    </div>
    </div>
<div class="news">
<h3>
    <p>最新<span>评论</span></p>
    </h3>
    <ul class="rank">
    <?php
    foreach ($r as $v) {
      echo '<li><a href="/" title="" target="_blank">'.$v['content'].'</a></li>';
    }
    ?>
    </ul>
    </div>
    <!-- Baidu Button BEGIN -->
</aside>
</article>
<?php
include_once($_SERVER["DOCUMENT_ROOT"].'/home/public/footer.php');
?>